package wsz.factory;

import lombok.Data;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.annotation.Bean;
import wsz.dao.JdbcDao;

/**
 * 自定义factoryBean
 * @author wsz
 * @date 2021/10/14 17:38
 **/
@Data
public class CommonFactoryBean implements FactoryBean<JdbcDao> {
    private String name;

    @Override
    public JdbcDao getObject() throws Exception {
        JdbcDao jdbcDao = new JdbcDao();
        jdbcDao.setName(name);

        return jdbcDao;
    }

    @Override
    public Class<?> getObjectType() {
        return JdbcDao.class;
    }
}
